﻿

// get the DOM of the current document
// var htmlDom = document.body.innerHTML;


//$.ajax({
//    type: "POST",
//    headers: { 'Content-Type': 'text/html; charset=UTF-8' },
//    url: "https://validator.w3.org/nu/?out=json",
//    data: htmlDom,
//    dataType: "json",
//    jsonp: "callback",

//    success: function(data) {

//        // displays the total notes
//        console.log("%c\n\nThe 'W3C' validator has detected " + data.messages.length + " errors during document analysis.\n\n", "color:black; font-size: 18px;");

//        $(data.messages).each(function(index) {

//            if (data.messages[index].type === "info") {

//                console.log("## WARNUNG ##\n" + data.messages[index].message + "\n\n");
//            }

//            if (data.messages[index].type === "error") {


//                var extractText = data.messages[index].extract.replace(/(\r\n|\n|\r)/gm, " ");
//                extractText = extractText.replace(/\s+/g, " ").trim();

//                console.warn("## ERROR ##" + " \n" +
//                    data.messages[index].message + " \n\n" +
//                    "## EXTRACTTEXT ##\n" + extractText + " \n" +
//                    "firstColumn : " + data.messages[index].firstColumn +
//                    ", firstLine : " + data.messages[index].firstLine +
//                    ", hiliteLength : " + data.messages[index].hiliteLength +
//                    ", hiliteStart : " + data.messages[index].hiliteStart +
//                    ", lastColumn : " + data.messages[index].lastColumn +
//                    ", lastLine : " + data.messages[index].lastLine + "\n\n"
//                );
//            }
             
//        });

//    },
//    error: function(textStatus) {
//        console.error("Sorry, there was a connection error to the w3c Server! \nThe error message is: " + textStatus);
//    }
//});
